1 package cz
.brmlab
.brmtron
.client
;
3 import android
.app
.Activity
;
4 import android
.content
.SharedPreferences
;
5 import android
.content
.SharedPreferences
.Editor
;
6 import android
.os
.Bundle
;
7 import android
.view
.View
;
8 import android
.view
.View
.OnClickListener
;
9 import android
.widget
.Button
;
10 import android
.widget
.EditText
;
12 public class EditOptions
extends Activity
{
14 SharedPreferences prefs
;
15 EditText server
, port
;
18 protected void onCreate(Bundle savedInstanceState
) {
19 super.onCreate(savedInstanceState
);
20 setContentView(R
.layout
.edit_options
);
22 prefs
= getSharedPreferences(BrmTronClient
.PREFS_FILE
, MODE_PRIVATE
);
24 server
= (EditText
) findViewById(R
.id
.edit_server
);
25 port
= (EditText
) findViewById(R
.id
.edit_port
);
26 Button confirmButton
= (Button
) findViewById(R
.id
.confirm
);
30 confirmButton
.setOnClickListener(new OnClickListener() {
32 public void onClick(View v
) {
40 protected void onPause() {
46 protected void onResume() {
52 protected void onSaveInstanceState(Bundle outState
) {
53 super.onSaveInstanceState(outState
);
57 private void saveOptions() {
58 Editor edit
= prefs
.edit();
59 edit
.putString(BrmTronClient
.PREFS_SERVER_KEY
, server
.getText().toString());
60 edit
.putString(BrmTronClient
.PREFS_PORT_KEY
, port
.getText().toString());
64 private void loadOptions() {
65 server
.setText(prefs
.getString(BrmTronClient
.PREFS_SERVER_KEY
, ""));
66 port
.setText(prefs
.getString(BrmTronClient
.PREFS_PORT_KEY
, ""));